+2001-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (popup_targets_received): only sensitize Cut
+ if selection contains some editable text, #60975
+ (gtk_text_view_scroll_to_iter): remove warning about scrolling
+ prior to map; it should actually be OK to do so in many cases,
+ it would be nice to warn about scrolling when many lines have
+ height 0, but I don't know what to do about that. Perhaps
+ move part of flush_scroll into this function? comment added
+ to consider this.
+
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Correctly keep the same
+2001-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (popup_targets_received): only sensitize Cut
+ if selection contains some editable text, #60975
+ (gtk_text_view_scroll_to_iter): remove warning about scrolling
+ prior to map; it should actually be OK to do so in many cases,
+ it would be nice to warn about scrolling when many lines have
+ height 0, but I don't know what to do about that. Perhaps
+ move part of flush_scroll into this function? comment added
+ to consider this.
+
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Correctly keep the same
+2001-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (popup_targets_received): only sensitize Cut
+ if selection contains some editable text, #60975
+ (gtk_text_view_scroll_to_iter): remove warning about scrolling
+ prior to map; it should actually be OK to do so in many cases,
+ it would be nice to warn about scrolling when many lines have
+ height 0, but I don't know what to do about that. Perhaps
+ move part of flush_scroll into this function? comment added
+ to consider this.
+
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Correctly keep the same
+2001-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (popup_targets_received): only sensitize Cut
+ if selection contains some editable text, #60975
+ (gtk_text_view_scroll_to_iter): remove warning about scrolling
+ prior to map; it should actually be OK to do so in many cases,
+ it would be nice to warn about scrolling when many lines have
+ height 0, but I don't know what to do about that. Perhaps
+ move part of flush_scroll into this function? comment added
+ to consider this.
+
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Correctly keep the same
+2001-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (popup_targets_received): only sensitize Cut
+ if selection contains some editable text, #60975
+ (gtk_text_view_scroll_to_iter): remove warning about scrolling
+ prior to map; it should actually be OK to do so in many cases,
+ it would be nice to warn about scrolling when many lines have
+ height 0, but I don't know what to do about that. Perhaps
+ move part of flush_scroll into this function? comment added
+ to consider this.
+
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Correctly keep the same
+2001-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (popup_targets_received): only sensitize Cut
+ if selection contains some editable text, #60975
+ (gtk_text_view_scroll_to_iter): remove warning about scrolling
+ prior to map; it should actually be OK to do so in many cases,
+ it would be nice to warn about scrolling when many lines have
+ height 0, but I don't know what to do about that. Perhaps
+ move part of flush_scroll into this function? comment added
+ to consider this.
+
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Correctly keep the same
+2001-10-23 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextview.c (popup_targets_received): only sensitize Cut
+ if selection contains some editable text, #60975
+ (gtk_text_view_scroll_to_iter): remove warning about scrolling
+ prior to map; it should actually be OK to do so in many cases,
+ it would be nice to warn about scrolling when many lines have
+ height 0, but I don't know what to do about that. Perhaps
+ move part of flush_scroll into this function? comment added
+ to consider this.
+
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (changed_handler): Correctly keep the same
gint scroll_inc;
gint screen_xoffset, screen_yoffset;
gint current_x_scroll, current_y_scroll;
+
+ /* FIXME why don't we do the validate-at-scroll-destination thing
+ * from flush_scroll in this function? I think it wasn't done before
+ * because changed_handler was screwed up, but I could be wrong.
+ */
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
DV(g_print(G_STRLOC"\n"));
- if (!GTK_WIDGET_MAPPED (widget))
- {
- g_warning ("gtk_text_view_scroll_to_iter(): calling this function before showing the GtkTextView doesn't make sense, maybe try gtk_text_view_scroll_to_mark() instead");
- return FALSE;
- }
-
gtk_text_layout_get_iter_location (text_view->layout,
iter,
&rect);
guint time;
} PopupInfo;
+static gboolean
+range_contains_editable_text (const GtkTextIter *start,
+ const GtkTextIter *end,
+ gboolean default_editability)
+{
+ GtkTextIter iter = *start;
+
+ while (gtk_text_iter_compare (&iter, end) < 0)
+ {
+ if (gtk_text_iter_editable (&iter, default_editability))
+ return TRUE;
+
+ gtk_text_iter_forward_to_tag_toggle (&iter, NULL);
+ }
+
+ return FALSE;
+}
+
static void
popup_targets_received (GtkClipboard *clipboard,
GtkSelectionData *data,
gboolean have_selection;
gboolean can_insert;
GtkTextIter iter;
-
+ GtkTextIter sel_start, sel_end;
+
if (text_view->popup_menu)
gtk_widget_destroy (text_view->popup_menu);
popup_menu_detach);
have_selection = gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
- NULL, NULL);
+ &sel_start, &sel_end);
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
&iter,
can_insert = gtk_text_iter_can_insert (&iter, text_view->editable);
append_action_signal (text_view, text_view->popup_menu, GTK_STOCK_CUT, "cut_clipboard",
- have_selection);
+ have_selection &&
+ range_contains_editable_text (&sel_start, &sel_end,
+ text_view->editable));
append_action_signal (text_view, text_view->popup_menu, GTK_STOCK_COPY, "copy_clipboard",
have_selection);
append_action_signal (text_view, text_view->popup_menu, GTK_STOCK_PASTE, "paste_clipboard",